/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.i.kotionokyurievna.jewelry.domain.productwork;

import ua.i.kotionokyurievna.jewelry.domain.workprice.Work;

/**
 *
 * @author Kateryna_Reznik
 */
public class ProductWork {
    private int productWorkId;
    private Work work; 
    private String quantity;
    private int productId;

    public ProductWork() {
    }

    public ProductWork(Work work, String quantity, int productId) {
        this.work = work;
        this.quantity = quantity;
        this.productId = productId;
    }

    public ProductWork(int productWorkId, Work work, String quantity, int productId) {
        this.productWorkId = productWorkId;
        this.work = work;
        this.quantity = quantity;
        this.productId = productId;
    }
    
    public ProductWork( ProductWork productWork ){
        if ( productWork != null ){
            this.productWorkId = productWork.productWorkId;
            this.work = productWork.work;
            this.quantity = productWork.quantity;
            this.productId = productWork.productId;
        }
    }

    public int getProductWorkId() {
        return productWorkId;
    }

    public Work getWork() {
        return work;
    }

    public void setWork(Work work) {
        this.work = work;
    }

    public String getQuantity() {
        return quantity;
    }

    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    @Override
    public String toString() {
        return "ProductWork{" + "productWorkId=" + productWorkId + ", work=" + 
                work + ", quantity=" + quantity + ", productId=" + 
                productId + '}';
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 89 * hash + (this.work != null ? this.work.hashCode() : 0);
        hash = 89 * hash + (this.quantity != null ? this.quantity.hashCode() : 0);
        hash = 89 * hash + this.productId;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ProductWork other = (ProductWork) obj;
        if (this.work != other.work && (this.work == null || 
                !this.work.equals(other.work))) {
            return false;
        }
        if ((this.quantity == null) ? (other.quantity != null) : 
                !this.quantity.equals(other.quantity)) {
            return false;
        }
        if (this.productId != other.productId) {
            return false;
        }
        return true;
    }
    
    
}
